<template>
  <div id="app">
    <div class="wrapper">
      <div class="themes">
        <button @click="setTheme('light')">light</button>
        <button @click="setTheme('dark')">dark</button>
      </div>
      <div class="main">
        <div class="content">
          <span>主题切换</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted() {
    this.setTheme('light');
  },
  methods: {
    setTheme(type) {
      window.document.documentElement.setAttribute('data-theme', type);
    },
  },
};
</script>

<style lang="scss">
@import '@/assets/scss/themes.scss';
html,
body {
  margin: 0;
  padding: 0;
}
#app {
  height: 100vh;
  width: 100vw;
  font-size: 32px;
  background-color: #ccc;
  .wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .themes {
      button {
        font-size: 1em;
        margin: 0 1em;
        padding: 0.5em 1em;
      }
    }
    .main {
      width: 100%;
      margin: 50px 0;
      padding: 50px 0;
      display: flex;
      justify-content: center;
      align-items: center;
      @include background_color('background_color1');
      @include font_color('font_color1');
    }
    .content {
      height: 300px;
      width: 600px;
      display: flex;
      justify-content: center;
      align-items: center;
      box-sizing: border-box;
      border: 2px solid;
      @include border_color('border_color1');
    }
  }
}
</style>
